//
//  CForgetPwd.m
//  HotDisPlus
//
//  Created by yilong zhang on 12-6-20.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "CForgetPwd.h"

@implementation CForgetPwd

@synthesize m_Email;
@synthesize m_Action;
@synthesize m_Target;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) 
    {
        UIImageView *bgimg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        bgimg.image = [UIImage imageNamed:@"appbg.jpg"];
        [self addSubview:bgimg];
        [bgimg release];
        
        bgimg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 45, 244, 30)];
        bgimg.center = CGPointMake(frame.size.width/2, bgimg.center.y);
        bgimg.image = [UIImage imageNamed:@"loginemail.png"];
        [self addSubview:bgimg];
        [bgimg release];
        
        m_Email = [[CTextField alloc] initWithFrame:CGRectMake(98, 48, 180, 25)];
        //m_Email.center = CGPointMake(frame.size.width/2, m_Email.center.y);
        //m_Email.placeholder = @"注册邮箱";
        m_Email.font = [UIFont systemFontOfSize:15];
        m_Email.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        m_Email.borderStyle = UITextBorderStyleNone;
        m_Email.returnKeyType = UIReturnKeyDone;
        m_Email.keyboardType = UIKeyboardTypeEmailAddress;
        m_Email.delegate = self;
        [self addSubview:m_Email];
        [m_Email release];
        
        UIButton *m_FindComitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        m_FindComitBtn.frame = CGRectMake(bgimg.frame.origin.x, bgimg.frame.origin.y+bgimg.frame.size.height+15, 75, 21);
        //[m_FindComitBtn setTitle:@"提交" forState:UIControlStateNormal];
        m_FindComitBtn.tag = 4;
        [m_FindComitBtn setBackgroundImage:[UIImage imageNamed:@"findpwd.png"] forState:UIControlStateNormal];
        [m_FindComitBtn addTarget:self action:@selector(OnButtonDown:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:m_FindComitBtn];
    }
    
    return self;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

-(void)OnButtonDown:(UIButton*)sender
{
    [m_Target performSelector:m_Action withObject:[NSNumber numberWithInt:sender.tag] withObject:m_Email.text];
}

@end
